<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<!--common::heads这里按需添加代码,如果没有link，style，script，则使用~{}填充参数位。参考下面代码-->
<head th:replace="common::heads(~{::title},~{},~{},~{})">
    <meta charset="UTF-8">
    <title>部门管理</title>
</head>
<body>
    <!--整体-->
    <div class="parent">
        <div th:replace="common :: top"></div>
        <div class="middle">
            <div th:replace="common::left"></div>

            <div class="right">
                <h3 style="text-align: center">部门管理</h3>
                <a href="/dept/info" style="margin: 10px;display: block">新增</a>
                <table border="1" cellpadding="0" cellspacing="0" class="datatable">
                    <tr>
                        <td style="width: 15%">ID</td>
                        <td style="width: 45%">名称</td>
                        <td style="width: 40%">操作</td>
                    </tr>
                    <tr th:each="dept:${pageInfo.list}">
                        <td th:text="${dept.id}">1</td>
                        <td th:text="${dept.name}">教务处</td>
                        <td>
                            <a style="margin-right: 10px" th:href="|/dept/info?id=${dept.id}|">修改</a>
                            <a href="javascript:" th:onclick="|remove(${dept.id})|">删除</a>
                        </td>
                    </tr>
                </table>
                <div style="text-align: right;margin-right: 20px">
                    <a th:href="|/dept/list?pageNum=1|">首页</a>
                    <a th:href="|/dept/list?pageNum=${pageInfo.prePage}|">上一页</a>
                    <a th:href="|/dept/list?pageNum=${pageInfo.nextPage}|">下一页</a>
                    <a th:href="|/dept/list?pageNum=${pageInfo.pages}|">最后一页</a>
                    <select id="selectPage" onchange="window.location.href='/dept/list?pageNum='+this.value">
                        <option th:each="num:${pageInfo.navigatepageNums}" th:selected="${pageInfo.pageNum==num}" th:text="${num}" th:value="${num}"></option>
                    </select>
                </div>
            </div>
        </div>
        <div th:replace="common::footer"></div>
    </div>

<script>
    function remove(id) {
        if(window.confirm('您确认要删除当前数据？')){
            window.location.href='/dept/delete?id='+id;
        }
    }

</script>
</body>
</html>